﻿@{
    var topics = (IEnumerable<Himall.Web.Areas.Admin.Models.TopicModel>)ViewBag.Topic;
    var slideImages = (IEnumerable<Himall.Web.Areas.Admin.Models.SlideAdModel>)ViewBag.SlideImages;
}
<div class="container">
    <ul class="nav nav-tabs-custom clearfix" style="margin-bottom:15px">
        <li class="active"><a>微信商城首页设置</a></li>
    </ul>

    <ul class="page-tab-hd page-wxindex">
        <li class="li1"><i class="glyphicon glyphicon-pencil"></i>轮播图配置</li>
        <li class="li2"><i class="glyphicon glyphicon-pencil"></i>首页推荐专题</li>
        <li class="li3"><i class="glyphicon glyphicon-pencil"></i>首页商品配置</li>
        <i class="arrow"></i>
    </ul>
    <div class="page-tab-bd">
        <div class="page-item">
            <div class="table-top"><a class="btn btn-primary btn-xs" id="addSlideImage"><i class="glyphicon glyphicon-plus"></i> 添加轮播图</a></div>
            <table id="slideImagesTable" class="table table-bordered"></table>
            <div class="form-group">
                <div class="col-sm-5">
                    <p class="help-default">注：可最多添加5个轮播图</p>
                </div>
            </div>

            <form class="form-horizontal" id="editSlideImage" style="display:none">
                <div class="form-group upload-img" id="imgUrl">
                    <div class="col-sm-3"></div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">描述：</label>
                    <div class="col-sm-9">
                        <input class="form-control input-sm" name="description" id="description" value="" maxlength="10" />
                        <p class="help-default">限10个字符</p>
                    </div>
                </div>
                <div class="form-group">
                    <label for="" class="col-sm-2 control-label">跳转链接：</label>
                    <div class="col-sm-9">
                        <input class="form-control input-sm" name="url" id="url" value="" />
                        <p class="help-default">如需跳转到专题，可点击右方选择，<a onclick="ChoceTopic()">选择专题</a></p>
                    </div>

                </div>
            </form>
            <input type="hidden" id="SlideImageBox" value="" />
            <input type="hidden" id="SlideImageId" value="" />

            <div id="choceTopicUrl" style="display:none">
				<div class="choose-search">
					<div class="form-group">
						<label class="label-inline" for="">标题</label>
						<input class="form-control input-ssm" type="text" id="titleKeyword">
					</div>
					<div class="form-group">
						<label class="label-inline" for="">标签</label>
						<input class="form-control input-ssm" type="text" id="tagsKeyword">
					</div>
					<button type="button" class="btn btn-warning btn-ssm" id="topicSearchButton">搜索</button>
				</div>
                <table id="topicGrid" class="table table-bordered"></table>
            </div>

        </div>
        <div class="page-item">
            <div class="table-top"><a class="btn btn-primary btn-xs" id="chooseTopicBtn"><i class="glyphicon glyphicon-plus"></i> 添加精选</a></div>
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th style="text-align:center">封面</th>
                        <th style="text-align:center">标题</th>
                        <th width="80" style="text-align:center">排序</th>
                        <th width="120" style="text-align:center">标签</th>
                        <th width="60" class="td-operate">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @if (topics.Count() > 0)
                    {
                        foreach (var topic in topics)
                        {
                            <tr id="@topic.Id">
                                <td width="150"><div style="text-align:center;" class="hiMallDatagrid-cell "><img width="100" height="24" src="@topic.FrontCoverImage"></div></td>
                                <td>@topic.Name</td>
                                <td><input class="text-order" type="text" orivalue="@topic.Sequence" name="sequence" value="@topic.Sequence"></td>
                                <td>@topic.Tags</td>
                                <td width="60" class="td-operate">
                                    <span class="btn-a">
                                        <a class="delete-classify" name="delete">删除</a>
                                    </span>
                                </td>
                            </tr>
                        }
                    }
                    else
                    {
                        <tr><td style="text-align:center;" colspan="5"><h2 style="font-size: 18px;padding-bottom: 10px;">还没有设置首页专题</h2></td></tr>
                    }
                </tbody>
            </table>

            <div id="choose-topic" style="display:none">
                <div class="topic-page-img upload-img clearfix" id="frontCoverImage">
                </div>
                <div class="choose-search" style="border-left: 1px solid #ddd;">
                    <div class="form-group">
                        <label class="label-inline" for="">专题标题</label>
                        <input class="form-control input-ssm" type="text" id="titleKeyword">
                    </div>
                    <div class="form-group">
                        <label class="label-inline" for="">标签</label>
                        <input class="form-control input-ssm" type="text" id="tagsKeyword">
                    </div>
                    &nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-primary btn-sm" id="searchButton">搜 索</button>
                </div>
                <table class="table table-bordered table-choose" id="list"></table>
            </div>
        </div>
        <div class="page-item">
            <div class="table-top"><a class="btn btn-primary btn-xs" id="addBtn"><i class="glyphicon glyphicon-plus"></i> 添加商品</a></div>
            <div class="search-box">
                <form class="custom-inline">
                    <div class="form-group">
                        <label class="label-inline" for="" style="width:54px;">商品/品牌</label>
                        <input class="form-control input-ssm" type="text" id="productName">
                    </div>
                    <div class="form-group">
                        <label class="label-inline" for="">分类</label>
                        <select id="category1" class="form-control input-ssm">
                            <option>分类</option>
                        </select>
                        <select id="category2" class="form-control input-ssm">
                            <option>分类</option>
                        </select>
                        <select id="category3" class="form-control input-ssm">
                            <option>分类</option>
                        </select>
                    </div>
                    <button type="button" class="btn btn-warning btn-ssm" id="productSearchButton">搜索</button>
                </form>
            </div>
            <table id="productList" class="table table-bordered"></table>
            <input type="hidden" id="categoryId" value="" />
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {


        $('.page-tab-hd li').click(function () {
            var top = $(this).position().top;
            var h = $(this).height();

            $('.page-tab-bd').css('marginTop', top).show().children().eq($(this).index()).show().siblings().hide();
            $('.arrow').css('top', top + h / 2 - 5).show();

        });

    });
</script>
<script src="~/Scripts/jquery.himallUpload.js"></script>
<script src="~/Scripts/jquery.hiMallDatagrid.js"></script>
<script src="~/Scripts/jquery.himallLinkage.nocreate.js"></script>
<script src="~/Areas/Admin/Scripts/wxSlideImages.js"></script>
<script src="~/Areas/Admin/Scripts/mobileHomeTopic.js"></script>
<script src="~/Scripts/jquery.productSelector.js"></script>
<script src="~/Areas/Admin/Scripts/wxProductSettings.js"></script>
